package com.smartcruise.base;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;

import com.smartcruise.R;
import com.smartcruise.util.FragmentUtils;

/**
 * Created by FengChaoQun
 * on 2018/1/20 0020
 * 仅包含一个fragment的activity
 */

@SuppressLint("Registered")
public abstract class BaseFragmentActivity extends BaseActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fragment_layout);
        if (getFragment() != null) {
            FragmentUtils.add(mFragmentManager, R.id.container, getFragment());
        } else {
            showToast(getString(R.string.nothingToShow));
        }
    }

    protected abstract Fragment getFragment();

}
